function [SpeedDistMatrix,Dist_estim, Velo_estim] = tdfft(Channel, SlotNum_zp, fNum_zp, density,ScS,TPRI,fc,key,CPLen,SymNum)
    addpath(genpath('commDef'))   
    c = 3e8;
    [NSc,SlotNum] = size(Channel);
    NSc = NSc/density;
    Channel_temp=zeros(NSc,SlotNum);
    %% 频域抽取

    %抽值：正频
    for i=1:density:NSc/2
        Channel_temp(i,:)=Channel(i,:);
    end
    %抽值：负频
    for i=NSc-density+1:-density:NSc/2+1
        Channel_temp(i,:)=Channel(i,:);
    end
    %% 剔零
    %Channel_temp = Channel;
    for i=1:SlotNum
        [Channel_temp2(:,i),~,Len] = Extraction(Channel_temp(:,i),density);
        %Len:获取频域抽取后频域的长度
    end

    %N/2补零
    times=fNum_zp;
    ChannelInterpol=zeros(times,SlotNum);   
    ChannelInterpol(1:Len/2,:)=Channel_temp2(1:Len/2,:);
    ChannelInterpol(times-Len/2+1:times,:)=Channel_temp2(Len/2+1:Len,:);
    % 第一次2D-FFT
    Matrix_IFFT=ifft(ChannelInterpol,times);
        % MTI
    [row, col] = size(Matrix_IFFT);
    H_MTI = zeros(row, col);
    H_MTI(:, 1) = Matrix_IFFT(:, 1);
    if key == 1          %一次对消
        for i = 2:col
            H_MTI(:, i) = Matrix_IFFT(:, i) - Matrix_IFFT(:, i-1);
        end
    elseif key == 2      %二次对消
        H_MTI(:, 2) = Matrix_IFFT(:, 2);
        for i = 3:col
            H_MTI(:, i) = Matrix_IFFT(:, i) + Matrix_IFFT(:, i-2) - 2.*Matrix_IFFT(:, i-1);
        end
    elseif key == 0
    else
        error("Wrong setting of key.")
    end
    Matrix_FFT=fft(H_MTI,SlotNum_zp,2);
    %% 速度域变化
    SpeedDistMatrix=zeros(times,SlotNum_zp);
    SpeedDistMatrix(:,1:SlotNum_zp/2) = Matrix_FFT(:,SlotNum_zp/2+1:SlotNum_zp);
    SpeedDistMatrix(:,SlotNum_zp/2+1:SlotNum_zp) = Matrix_FFT(:,1:SlotNum_zp/2);
    %% 最大值对应的行索引和列索引
    [~,MaxIndexVel] = max(max(SpeedDistMatrix));
    [~,MaxIndexDist] = max(SpeedDistMatrix(:,MaxIndexVel));

    %% 计算距离和速度
    MaxIndexDist=MaxIndexDist*length(Channel_temp)/times/density;
    Dist_estim=(MaxIndexDist-1)*c/(2*ScS*4096);
    Velo_estim=(MaxIndexVel-SlotNum_zp/2-1)*SlotNum/SlotNum_zp*c/(2*TPRI*SlotNum*fc);
%         %% 频域校准
%     f0_estim = 2*(Velo_estim)*fc/c;
%     for i=1:SlotNum
%         f0_phase_Matrix(:,i)=exp(1j*2*pi*(-f0_estim)/ScS*(fNum_zp+CPLen)*(i-1)*SymNum/fNum_zp);
%     end
%     Matrix_IFFTFD=Matrix_IFFT.*f0_phase_Matrix;
%     % MTI
%     [row, col] = size(Matrix_IFFTFD);
%     H_MTI = zeros(row, col);
%     H_MTI(:, 1) = Matrix_IFFTFD(:, 1);
%     if key == 1          %一次对消
%         for i = 2:col
%             H_MTI(:, i) = Matrix_IFFTFD(:, i) - Matrix_IFFTFD(:, i-1);
%         end
%     elseif key == 2      %二次对消
%         H_MTI(:, 2) = Matrix_IFFTFD(:, 2);
%         for i = 3:col
%             H_MTI(:, i) = Matrix_IFFTFD(:, i) + Matrix_IFFTFD(:, i-2) - 2.*Matrix_IFFTFD(:, i-1);
%         end
%     elseif key == 0
%     else
%         error("Wrong setting of key.")
%     end
%     % 第二次2D-FFT
%     Matrix_FFT2=fft(H_MTI,SlotNum_zp,2);
%     %% 速度域变化
%     SpeedDistMatrix_2=zeros(fNum_zp,SlotNum_zp);
%     SpeedDistMatrix_2(:,1:SlotNum_zp/2) = Matrix_FFT2(:,SlotNum_zp/2+1:SlotNum_zp);
%     SpeedDistMatrix_2(:,SlotNum_zp/2+1:SlotNum_zp) = Matrix_FFT2(:,1:SlotNum_zp/2);
%     %% 最大值对应的行索引和列索引
%     [~,MaxIndexVelFreq] = max(max(SpeedDistMatrix_2));
%     [~,MaxIndexDistFreq] = max(SpeedDistMatrix_2(:,MaxIndexVelFreq));    
%     %% 计算距离和速度
%     Dist_estim_2=(MaxIndexDistFreq-1)*c/(2*ScS*4096);
%     Velo_estim_2=(MaxIndexVelFreq-SlotNum_zp/2-1)*SlotNum/SlotNum_zp*c/(2*TPRI*SlotNum*fc);

end